<template>
    <el-dialog :title="title" :visible.sync="open" width="90%" append-to-body :close-on-click-modal="false"
               v-dialogDrag>
        <div style="margin-left: 10px;">
          <div style=" display: flex;align-items: center;margin-bottom: 10px;margin-top: 10px;">
          </div>
            <el-form ref="form" :rules="rules" label-width="120px">
              <el-table :data="columns" ref="dragTable" row-key="id" v-loading="loading">
                <el-table-column type="selection" width="55" align="center"/>
                <el-table-column label="任务编号" align="center" prop="a"/>
                <el-table-column label="任务名称" align="center" prop="s"/>
                <el-table-column label="数量" align="center" prop="d"/>
                <!--<el-table-column label="生产数量" align="center" prop="q"/>
                <el-table-column label="剩余数量" align="center" prop="w" >
                    <template slot-scope="scope">
                        <span style="color: red; font-weight: bold;">
                        {{ scope.row.w }}
                        </span>
                    </template>
                </el-table-column>-->
                <el-table-column label="班组编号" align="center" prop="f"/>
                <el-table-column label="班组名称" align="center" prop="g"/>
                <el-table-column label="订单编号" align="center" prop="h"/>
                <el-table-column label="订单名称" align="center" prop="j" width="180"/>
                <el-table-column label="工作站名称" align="center" prop="k"/>
                <el-table-column label="工席编号" align="center" prop="l"/>
                <el-table-column label="工席名称" align="center" prop="z"/>
                <el-table-column label="开始生产时间" align="center" prop="x"/>
                <el-table-column label="预计完成时间" align="center" prop="c" width="180"></el-table-column>
                <!-- <el-table-column align="center" class-name="small-padding fixed-width" label="操作" width="140">
                  <template slot-scope="scope">
                    <el-button size="mini" type="text" icon="el-icon-edit"  @click="modify(scope.row)">修改</el-button>
                  </template>
                </el-table-column> -->
              </el-table>
            </el-form>
          <yiFahuo-list ref="fahuomingxiList" @ok="getList"></yiFahuo-list>
          <lvFahuoBohui-form ref="modifyfahuomingxi" @ok="getList"></lvFahuoBohui-form>
        </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </template>

  <script>
    import { getAction,addAction,getById} from '@/api/manage'
    import YiFahuoList from '@/views/develop/lvYifahuomingxi/YiFahuoList'
    import LvFahuoBohuiForm from '@/views/develop/lvYifahuomingxi/module/LvFahuoBohuiForm'
    export default {
      name: "GoodsTaskForm",
      dicts: [  'goods_customer'],
      components: {
        YiFahuoList,
        LvFahuoBohuiForm,
      },
      data() {
        return {
          title: "生产任务",
          open: false,
          // 遮罩层
          loading: false,
          // 选中数组
          ids: [],
          rows: [],
          rules: {
          },
          // 非单个禁用
          single: true,
          // 非多个禁用
          multiple: true,
          // 显示搜索条件
          showSearch: true,
          // 总条数
          total: 0,
          // 销售信息管理表格数据
          dataList: [],
          columns: [
            {
                q:'2',
                w:'1',
                a:'TASK20240017',
                s:'滚珠螺母【3】个',
                d:'3.0',
                f:'111',
                g:'11',
                h:'MO20240730091.',
                j:'796863',
                k:'222',
                l:'PROCESS543',
                z:'螺母下料',
                x:'2024-08-06 11:00:00',
                c:'2024-08-06 16:00:00',
            },
            {
                q:'3',
                w:'0',
                a:'TASK20240018',
                s:'车三角螺纹【3】个',
                d:'3.0',
                f:'111',
                g:'11',
                h:'MO20240730091.',
                j:'796863',
                k:'222',
                l:'PROCESS543',
                z:'车三角螺纹',
                x:'2024-08-08 11:00:00',
                c:'2024-08-08 16:00:00',
            }
          ],
          // 查询参数
          queryParams: {
            pageNum: 1,
            pageSize: 20000,
            nos: null,
            name: null,
            fahuoDate: null,
            jiaohuoDate: null,
            linkman: null,
            linktel: null,
            address: null,
            status: null,
            jingli: null,
            kehuId: null,
            kehuName: null,
            taxNo: null,
            taxCode: null,
            taxDate: null,
            taxMoney: null,
            taxShengyu: null,
            taxAllmoeny: null,
            allMoney: null,
            shengyu: null,
            yihui: null,
            daohuoDate: null,
            daohuoFile: null,
            tongzhiId: null,
            tongzhiNo: null,
            params: {},
          },
          url: {
            list:'/lvYifahuo/lvYifahuo/list',
          },
          tableMaxHeight: window.innerHeight - 320,
        };
      },
      created() {
        // this.intDictsForPrj();
        window.addEventListener('resize', this.getTableHeight);
      },
      destroyed() {
        window.removeEventListener('resize', this.getTableHeight);
      },
      methods: {
        taskShow(row){
            this.open = true;
        },
        modify(row){
          this.$refs.modifyfahuomingxi.showModifyMingxi(row);
        },
        xiangqing(row){
          this.$refs.fahuomingxiList.showMingxi(row);
        },
        // 取消按钮
        cancel() {
          this.open = false;
          this.reset();
        },
        getTableHeight() {
          this.tableHeight = window.innerHeight - 320
        },
        showFahuodanList(row){
          this.queryParams.tongzhiId=row.id;
          this.open=true;
          this.getList();
        },
        /** 查询销售信息管理列表 */
        getList() {
          this.loading = true;
          getAction(this.url.list, this.queryParams).then(response => {
            this.columns = response.rows;
            this.total = response.total;
            this.loading = false;
          });
        },
        /** 搜索按钮操作 */
        handleQuery() {
          this.queryParams.pageNum = 1;
          this.getList();
        },
      }
    };
  </script>
